/**
 * Carnegie Mellon University
 * School of Computer Science
 * MSIT eBusiness Technology
 * 
 * Team 8 - Infinity (2011 Spring)
 * infinity-team8@googlegroups.com
 * 
 * Professor: Jeffrey L. Eppinger
 * Program Faculty: Sujata Telang
 */

package controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import model.Model;
import databean.CustomerBean;

public class CustomerTransactionHistoryAction extends Action {


	public CustomerTransactionHistoryAction(Model model) {
		
	}

	public String getName() {
		return "customer-transaction-history.do";
	}

	public String perform(HttpServletRequest request,
			HttpServletResponse response) {
		// Set up the errors list
		List<String> errors = new ArrayList<String>();
		request.setAttribute("errors", errors);

		// returns the existing session or null, if the session does not exist.
		HttpSession session = request.getSession(false);
		String rs = "";
		if (session != null) {
			CustomerBean customer = (CustomerBean) session
					.getAttribute("customer");
			if(customer!=null){
				rs=""+customer.getCustomerID();
			}
		}
        request.setAttribute("rs", rs);
		return "customer-transaction-history.jsp";

	}
}
